Multiple Replace All

Hey...

I want to realize something like a multiple replace all function.
There is a module with an attribute 'name' and an attribute 'value'. The names and values shall get into a list.
And there is another module which shall be parsed for the names. I want to chose from the list, which values shall be replaced.

Example...

Names and values list:
name value


name1 A
name2 B
name3 C

Module, in which shall be replaced:
name1=D
name2=E
name3=F

So, I just want to replace name1 and name3. Every "name1=*don't care*" shall be replaced by "name1=A" and so on...

Has anysome a idea or some code how to do this?
Thanks a lot in advance...
Mr.Ferrari - Tue Oct 05 09:27:57 EDT 2010

Re: Multiple Replace All
llandale - Wed Oct 06 17:04:52 EDT 2010

Huh?

Does this help?

void  ReplaceValue(Module in_mod, string in_NameAttr, in_ValueIgnore, in_ValueNew)
{  // Replace all object attribute values in the module that are null or to be Ignored
   //   with the new Value
 
    Object obj
    string ValueOld
 
    for obj in entire in_mod) do
    {  if (isDeleted(obj))    continue
       ValueOld = probeAttr_(obj, in_NameAttr)
       if (null ValueOld or ValueOld == in_ValueIgnore)
       {  noError()
          obj.NameAttr = in_ValueNew
          lastError()
       }
    }
} // end ReplaceValue()

 

  • Louie